/*
* @Author: chenggh
* @Date: 2025-06-22
* @Link to Problem : https://webvpn.neu.edu.cn/https/62304135386136393339346365373340bfebea318fd008d8f60d257088/courses/27/part/224/problem/1012
*/
#include <iostream>
#include <set>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	set<int> pos;
	pos.insert(0);
	int x; cin >> x;
	pos.insert(x);
	
	multiset<int> len;
	len.insert(x);
	
	int k; cin >> k;
	//for(auto x: len) cout << x << " ";

	for(int i = 0, temp; i < k; i++){
		cin >> temp;
		auto it_lower = pos.upper_bound(temp);
		auto it_upper = it_lower;
		it_lower--;
		int len_cut = *it_upper - *it_lower;
		
		pos.insert(temp);
		auto it = len.find(len_cut);
		if(it != len.end()) len.erase(it);
		len.insert(temp - *it_lower);
		len.insert(*it_upper - temp);

		// for(auto x: len) cout << x << " ";
		// cout <<  "   asdf " << endl;
		cout << *len.rbegin() << " ";
	}cout << endl;
	return 0;
}